<!-- 详情-->
<template>
    <div class="">
        <el-breadcrumb separator="/" class="bread-title">
            <el-breadcrumb-item :to="{ path: '/projectList' }">跟投项目管理</el-breadcrumb-item>
            <el-breadcrumb-item>详情</el-breadcrumb-item>
        </el-breadcrumb>
        <viewDetail :totalData="totalData"></viewDetail>
        <p style="text-align:center">
            <el-button type="primary" @click="$router.go(-1)">关闭</el-button>
        </p>
    </div>
</template>
<script>
    import api from '@/api/apiPath'
    import viewDetail from './operateFollowProCom/viewDetail'
    import utils from '@/common/utils.js'

    export default {
        components: {
            viewDetail
        },
        data() {
            return {
                id: 0,
                totalData: []
            }
        },
        methods: {
            concatData(data) {
                console.log(data);

                return Promise.all([
                    this.axios.post(api.followUpControlDetail, {id: data.projectStandard[0].standardId}),
                    this.axios.get(api.DISTRIBUTTIONVIEW + data.projectStandard[1].standardId),
                    this.axios.get(api.INVESTSECTIONS + "/" + data.projectStandard[2].standardId),
                ]).then(res => {
                    console.log(res);
                    this.totalData = {
                        firstStep: {
                            //mongoProjectId: project.estateProjectId,
                            projectName: data.projectInfo.projectName,
                            companyId: data.projectInfo.companyId,
                            companyName: data.projectInfo.companyName,
                            cityId: data.projectInfo.cityId,
                            cityName: data.projectInfo.cityName,
                            accountCompanyId: data.projectInfo.id,
                            accountCompanyName: data.projectInfo.companyName,
                            accountName: data.projectInfo.accountName,
                            openingBank: data.projectInfo.openingBank,

                            bankAccount: data.projectInfo.bankAccount,
                            bankNumber: data.projectInfo.bankNumber,
                            bankAreaCode: data.projectInfo.bankAreaCode,
                            openingBankProvince: data.projectInfo.openingBankProvince,
                            openingBankCity: data.projectInfo.openingBankCity,

                            applyBeginTime: utils.getTimeString(data.projectInfo.applyBeginTime),
                            applyEndTime: utils.getTimeString(data.projectInfo.applyEndTime),
                            investBeginTime: utils.getTimeString(data.projectInfo.investBeginTime),
                            investEndTime: utils.getTimeString(data.projectInfo.investEndTime),
                            estimateCycle: data.projectInfo.estimateCycle,
                            gainsType: data.projectInfo.gainsType,
                            investPlan: data.projectInfo.investPlan,
                            gainsExplain: data.projectInfo.gainsExplain,
                            applyRule: data.projectInfo.applyRule,
                        },
                        secondStep: {
                            ruleForm2: {
                                modeId: data.projectInfo.businessMode,
                                totalAmount: data.projectInfo.investTotalMoney,
                                profitPercent: data.projectInfo.projectedProfitMargin
                            },
                            bindStandardInfo: [
                                {
                                    ...res[0].data.data.vote,
                                    moneys: res[0].data.data.voteMoneys
                                },
                                res[1].data.data,
                                res[2].data.data.shareOut
                            ]
                        },
                        thirdStep: {
                            ruleForm3: {
                                money1: data.projectRaise.investMoney,
                                scale: data.projectRaise.raiseInvestProportion,
                                money2: data.projectRaise.raiseInvestAmount,
                                count: data.projectRaise.investNum,
                                minCount: data.projectRaise.minInvestNum,
                                maxCount: data.projectRaise.maxInvestNum,
                            }
                        },
                        fourthStep: {
                            projectFixedPersonList: data.distributionList
                        },
                    };

                })
            },
            getDetails() {
                this.axios.get(`${api.getProjectProDetails}/${this.id}`).then(res => {
                    if (res.data.code === 200) {
                        this.concatData(res.data.data)
                    }
                })
            }
        },
        created() {
            this.id = this.$route.query.id
            this.getDetails()
        },

        destroyed() {

        },
        filters: {}
    }

</script>

<style lang="stylus" scoped>


</style>
